<?php
/**
 * initialise block
 * 
 */
function IShopStore_CartItemsblock_init()
{

}

/**
 * get information on block
 * 
 * @return       array       The block information
 */
function IShopStore_CartItemsblock_info()
{
    return array('text_type'      => 'Cart Items',
                 'module'         => 'IShopStore',
                 'text_type_long' => 'Customer carts',
                 'allow_multiple' => true,
                 'form_content'   => false,
                 'form_refresh'   => false,
                 'show_preview'   => true);
}

/**
 * display block
 * 
 * @param        array       $blockinfo     a blockinfo structure
 * @return       output      the rendered bock
 */
function IShopStore_CartItemsblock_display($blockinfo)
{
    $modname  = 'IShopStore';
    $class    = 'CartItems';

    $modinfo = pnModGetInfo(pnModGetIDFromName($modname));
    $directory = $modinfo['directory'];
    pnModDBInfoLoad($modname, $directory);
    //load render
    $render = pnRender::getInstance($modname);

    $blockinfo['content'] = $render->fetch('block_cartitems.htm');
    return themesideblock($blockinfo);
}


/**
 * modify block settings
 * 
 * @author       The PostNuke Development Team
 * @param        array       $blockinfo     a blockinfo structure
 * @return       output      the bock form
 */
function IShopStore_CartItemsblock_modify($blockinfo)
{
/*
  $vars = pnBlockVarsFromContent($blockinfo['content']);
  //load render
  $render = pnRender::getInstance('IShopStore');
  $render->assign('form', $vars);
  
	return $render->fetch('block_newitem_modify.htm');
	*/
	return false;
}


/**
 * update block settings
 * 
 * @author       The PostNuke Development Team
 * @param        array       $blockinfo     a blockinfo structure
 * @return       $blockinfo  the modified blockinfo structure
 */
function IShopStore_CartItemsblock_update($blockinfo)
{
    
    // Get current content
    $vars = pnBlockVarsFromContent($blockinfo['content']);

    // write back the new contents
    $blockinfo['content'] = pnBlockVarsToContent($vars);

    // clear the block cache
    $pnRender = pnRender::getInstance('IShopStore');
    $pnRender->clear_cache('block_cartitems.htm');
    
    return $blockinfo;
}
